// components/local-search/index.js
const checkCity = require('../../utils/checkCity.js');
Component({
  /**
   * 组件的属性列表
   */
  properties: {

  },
  /**
   * 组件的初始数据
   */
  data: {
    cityListId: '',
    isCityShow: 'noshow',
    defaultCity: '',
    latitude: "",
    longitude: ""
  },
  /**
   * 获取本机的地址位置信息,并设置
   */
  lifetimes: {
    attached: function (e) {
      var that = this;
      const pages = getCurrentPages()[0].route
      wx.setStorage({
        key: "backroute",
        data: "/"+pages
      })
      checkCity.check(function (city){
        that.setData({
          defaultCity: city.fullname,
          latitude: city.lat,
          longitude: city.lng,
        })
      });
    }
  },
  /**
   * 组件的方法列表
   */
  methods: {
    goToSearch: function() {
      wx.navigateTo({
        url: '/pages/recruit/search/search',
      })
    }
  }
})